package com.lingkang.flychat.controller;

import com.lingkang.flychat.dto.ResponseResult;
import com.lingkang.flychat.service.RedisService;
import com.lingkang.flychat.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author linke
 * @date 2020/4/11 21:22
 * @description
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private HttpServletRequest request;
    @Autowired
    private UserService userService;
    @Autowired
    private RedisService redisService;

    @GetMapping("/info")
    public ResponseResult info(String token) {
        return userService.info(redisService.getUsernameByToken(token));
    }
}
